<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <!--<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>-->
    <!--<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>-->
    <!--[endif]-->
    <script type="text/javascript" src="../../common/js/public.js"></script>
    <script type="text/javascript" src="../../common/js/publicUtils.js"></script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <div class="datacash" style="width:100%;">
            <table class="layui-table" id="datatable"></table>
        </div>
    </div>
</div>
<script>
    var id;
    $(function () {
        orgTypeMap = getDic("OrgJob");
    })

    function loadType(){
        layui.use(['form','element'], function() {
            form = layui.form;
            var layer=layui.layer;;
            var option="<option value=''>全部</option>";
            for(var key of orgTypeMap){
                option += "<option value='"+key[0]+"'>"+key[1]+"</option>";
            }
            $("#job").html(option);
            form.render();
        })

    }
    function inintData(val){
        id = val;
        loadTable(val);
    }

    /**
     * 初始化右侧table
     * @param data
     */
    function loadTable(id){
        layui.use(['form','table'], function(){
            form = layui.form;
            table = layui.table;
            tableObj1 = table.render({
                elem: '#datatable',
                size: 'sm',
                even: true, //开启隔行背景
                height: 'full-60',
                method: 'post',
                url:publicUrl+"orgrole/selectJobListByCondition",
                headers: {"Authorization":getData("Authorization")},
                where:{
                    'roleId':id
                },
                parseData: function(res){ //res 即为原始返回的数据
                    return formatTableParseData(res);
                },
                request: {
                    pageName: 'pageIndex' //页码的参数名称，默认：page
                    ,limitName: 'pageSize' //每页数据量的参数名，默认：limit
                },
                response: {
                    statusCode: 2000,
                },
                cols: [[
                    {
                        type:'checkbox',
                        width: 50,
                    },
                    {
                        type: 'numbers',
                        title: '序号',
                        width: 50,
                        align: 'center',
                    }, {
                        field: 'code',
                        title: '职责编码',
                        width: '15%',
                        sort: true,
                        align: 'center',
                    },{
                        field: 'name',
                        title: '职责名称',
                        width: '15%',
                        sort: true,
                        align: 'center',
                    },{
                        field: 'name',
                        title: '职责内容',
                        width: '40%',
                        align: 'center',
                    }, {
                        field: 'job',
                        title: '适用岗位',
                        width: '15%',
                        align: 'center',
                        templet: function(d) {
                            return orgTypeMap.get(d.job+"");
                        }
                    }]],
                page: true
            });

        });
    }

</script>
</body>

</html>
